package project5;

import java.util.ArrayList;

/**
 * This class takes a string of delimiter characters and determines their octal values. 
 * @author Surabhi Diwan
 */
public class DelimiterProcessor
{

	/** The list of octal values of break characters. */
	ArrayList<Integer> delimiter_octals;

	/**
	 * This constructs a DelimiterProcessor object, parses the octal value of each delimiter in the String delimiters, and stores it to an ArrayList.
	 * @param delimiters
	 */
	DelimiterProcessor(String delimiters)
	{
		delimiter_octals = new ArrayList<Integer>();
		byte[] byte_array = delimiters.getBytes();
		
		for(int i =0; i<delimiters.length(); i++)
		{
			Byte b = new Byte(byte_array[i]);
			delimiter_octals.add(new Integer(Integer.parseInt(Integer.toOctalString(b.intValue()))));
		}
	}

	/**
	 * This returns a list of the octal values of the delimiters.
	 * @return      An ArrayList containing the octal values of the characters in the string provided to the constructor.
	 */
	public ArrayList<Integer> getDelimiters()
	{
		return delimiter_octals;
	}
}
